Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(create-vite): move common ts settings to base tsconfig #19228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fmal
Copy link

@fmal fmal commented Jan 19, 2025

Description

Discussed this briefly with @ArnaudBarre on Discord, this is a proposal to avoid duplication between tsconfigs.

Some Vite starter templates with typescript include tsconfig.json that references tsconfig.app.json and tsconfig.node.json. A lot of settings between app and node configs are repeated. This PR moves shared config props to root tsconfig.json and makes tsconfig.app.json and tsconfig.node.js inherit compilerOptions from it.

This works because references are excluded from inheritance (see https://www.typescriptlang.org/tsconfig/#extends)

@fmal fmal force-pushed the fmal/patch-94089 branch from bd2a88d to 0a13901 Compare January 19, 2025 11:02
@dominikg
Copy link
Contributor

if this is motivated by DRY principles, i would ask to reconsider. Sharing compilerOptions between different config files that target different parts of an application should only be done because they are connected in that sense and you want to be able to have this file as a shared source of truth to prevent having to edit a compiler option in 2 places instead of one.

Creating a more complex extends chain is not only less tracable for human reading but also adds (a little) overhead to tsconfck for parsing these.

@dominikg
Copy link
Contributor

Also keep in mind that these starters are intended to be a minimal starting point and carry little to no opinion and avoid complexity where possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants